<?php 
	if ((!defined("ADMIN-AREA")) || (!in_array(SHOWVIEW,$_SESSION['access']))) {
		die("No data");
	} else {
		unset($_SESSION['access']);
	}

	include_once "modul/funct_stat.php";
	
	if (ACT=="edit") {
		$kode = (int) $_GET['kode'];
		$sql1 = "SELECT * FROM propinsi WHERE idx='".$kode."' LIMIT 1";
		$qry1 = mysql_query($sql1);
		while ($row1 = mysql_fetch_object($qry1)) {
			$id_prop = $row1->id_propinsi;
			$nama_prop = $row1->nama_propinsi;
		};
		
		$form_stat = "Edit";
	} else {
		$form_stat = "Input";
	}
	
	if ((ACT=="tambah") || (ACT=="edit")) {
?>
<form name="form1" method="post" action="<?php echo $path; ?>ver_propinsi.php?show=<?php echo SHOW; ?>&amp;showview=<?php echo SHOWVIEW; ?>" onsubmit="MM_validateForm('<?php echo $PROP_ID; ?>','','R','<?php echo $PROP_NAME; ?>','','R');return document.MM_returnValue">
  <table width="75%" border="0" align="center" cellpadding="4" cellspacing="1" class="content-arial">
    <tr valign="top">
      <td valign="middle" nowrap="nowrap"><div align="right"><?php echo $PROP_ID; ?></div></td>
      <td valign="middle"><div align="center">:</div></td>
      <td valign="middle"><div align="left">
          <input name="id_prop" type="text" id="<?php echo $PROP_ID; ?>" value="<?php echo $id_prop; ?>" size="25" class="input-title" />
      </div></td>
    </tr>
    <tr valign="top"> 
      <td width="21%" nowrap> <div align="right"><?php echo $PROP_NAME; ?></div></td>
      <td width="5%"> <div align="center">:</div></td>
      <td width="74%"> <div align="left"> 
          <input name="nama_prop" type="text" id="<?php echo $PROP_NAME; ?>" value="<?php echo $nama_prop; ?>" size="30">
        </div></td>
    </tr>
    <tr valign="top"> 
      <td> <div align="right"></div></td>
      <td> <div align="center"></div></td>
      <td> <div align="left">
        <input type="submit" name="submit" id="submit" value="<?php echo $DEV_CTRL_SUBMIT; ?>" />
          <input type="reset" name="Reset" value="<?php echo $DEV_CTRL_RESET; ?>" />
<input name="act_ver" type="hidden" id="act_ver" value="<?php echo strtolower($form_stat); ?>">
          <input name="kode" type="hidden" id="kode" value="<?php echo $kode; ?>">
      </div></td>
    </tr>
  </table>
</form>
<?php
	} else {
		echo $queryData->cari_form($PROP_SEARCH);
		$caridata = $queryData->cari_padaku("id_propinsi","nama_propinsi");
		if (isset($_SESSION['isroot'])) {
			$sql1 = "SELECT * FROM propinsi WHERE 1 ".$caridata." ORDER BY idx DESC LIMIT ".$limitdown.",10 ";	
		} else {
			$sql1 = "SELECT * FROM propinsi WHERE 1 ".$caridata." ORDER BY idx DESC LIMIT ".$limitdown.",10";	
		}
?>
<table align="center" cellpadding="4" cellspacing="2" class="imagesSUB">
  <tr> 
    <th width="100" height="30" class="imagesSUB"><div align="center"><?php echo $PROP_ID; ?></div></th>
    <th width="300" class="imagesSUB"><div align="center"><?php echo $PROP_NAME; ?></div></th>
    <th width="50" class="imagesSUB"><div align="center"><?php echo $DEV_ACTION; ?></div></th>
  </tr>
<?php
		$qry1 = mysql_query($sql1);
		$numrow = mysql_num_rows($qry1);
		$num = 1;
		$x = 1;
		if ($numrow==0) {
			echo '<tr><th colspan="3">'.$DEV_NO_DATA.'</th></tr>';
		} else {
			while ($row1 = mysql_fetch_object($qry1)) {
				$data = $x % 2;
				if ($data==0) {
					$dataX = "ganjil";
				} else {
					$dataX = "genap";
				} 
?>
  <tr valign="top" class="<?php echo $dataX; ?>" onmouseover="setBG('bg<?php echo $x; ?>','#FFFFDD')" onmouseout="setBG('bg<?php echo $x; ?>','')" id="bg<?php echo $x; ?>"> 
    <td><div align="left"><?php echo $row1->id_propinsi; ?></div>    </td>
    <td><div align="left"><?php echo $row1->nama_propinsi; ?></div></td>
        <?php echo $queryData->ctrl_data('','index.php?show='.SHOW.'&showview='.SHOWVIEW.'&act=edit&kode='.$row1->idx,$path.'ver_propinsi.php?show='.SHOW.'&amp;showview='.SHOWVIEW.'&amp;kode='.$row1->idx.'&amp;act_ver=Hapus'); ?>
  </tr>
<?php 
				$num++;
				$x++;
			}
		}
?>
</table>
<div align="center"><?php echo $queryData->next_prev($num,$pages_syarat,$limitdown); ?></div>
<?php
	}
?>